package service;

import javax.ejb.EJB;
import service.finder.FinderService;

/**
 *
 * @author Juan Sebastian Hernández Serrato
 */
public class ServiceFactory {

    private static ServiceFactory instance;
    
    private ServiceFactory(){}
    
    public static ServiceFactory getInstance(){
        if(instance == null){
            instance = new ServiceFactory();
        }
        return instance;
    }
    
    private CategoryService categoryService;
    private CourseService courseService;
    private NodeService nodeService;
    private ProfessorService professorService;
    private RoleService roleService;
    private UniversityService universityService;
    private UserService userService;
    private FinderService finderService;

    public CategoryService getCategoryService() {
        if (categoryService == null) {
            categoryService = new CategoryService();
        }
        return categoryService;
    }

    public CourseService getCourseService() {
        if (courseService == null) {
            courseService = new CourseService();
        }
        return courseService;
    }

    public NodeService getNodeService() {
        if (nodeService == null) {
            nodeService = new NodeService();
        }
        return nodeService;
    }

    public ProfessorService getProfessorService() {
        if (professorService == null) {
            professorService = new ProfessorService();
        }
        return professorService;
    }

    public RoleService getRoleService() {
        if (roleService == null) {
            roleService = new RoleService();
        }
        return roleService;
    }

    public UniversityService getUniversityService() {
        if (universityService == null) {
            universityService = new UniversityService();
        }
        return universityService;
    }

    public UserService getUserService() {
        if (userService == null) {
            userService = new UserService();
        }
        return userService;
    }
    

    public FinderService getFinderService() {
        if(finderService == null){
            finderService = new FinderService();
        }
        return finderService;
    }
    
    
//    Ejemplo de creacion por demanda de un servicio para ServiceFactory
//    
//    private ActividadService actividadService;
//
//    public ActividadService getActividadService() {
//        if (actividadService == null) {
//            actividadService = new ActividadService();
//        }
//        return actividadService;
//    }
    
}
